CesiumWidget together with CZML library

This notebook shows how to use the CesiumWidget together with the CZML library from https://github.com/cleder/czml

If the CesiumWidget is installed correctly, Cesium should be accessable at: http://localhost:8888/nbextensions/CesiumWidget/cesium/index.html


In [9]:
from CesiumWidget import CesiumWidget
import czml

Some data for the viewer to display


In [10]:
# Initialize a document
doc = czml.CZML()

In [11]:
# Create and append the document packet
packet1 = czml.CZMLPacket(id='document',version='1.0')
doc.packets.append(packet1)

In [12]:
p3 = czml.CZMLPacket(id='test')
p3.position = czml.Position(cartographicDegrees = [18.07,59.33, 20])
point = czml.Point(pixelSize=20, show=True)
point.color = czml.Color(rgba=(223, 150, 47, 128))
point.show = True
p3.point = point

In [13]:
l = czml.Label(show=True, text='Stockholm')
l.scale = 0.5
p3.label = l
doc.packets.append(p3)

Create widget object


In [14]:
cesiumExample = CesiumWidget(width="100%", czml=tuple(doc.data()))

Display the widget:


In [16]:
cesiumExample